package com.bt.lms.ui.action.school_education.stu_msg_manage;


import com.bt.lms.ui.page.common.action.pagerecord.RecruitStuLabAction;
import com.bt.lms.ui.page.school_education.stu_mes_manage.PageStudentMesManage;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.Cursor;

import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;

/**
 * 学员学籍信息管理按钮事件
 */

public class StudentStatusMesAction implements EventHandler {


    private Label label;

    public StudentStatusMesAction(Label number1Lab) {
        this.label = number1Lab;
    }


    @Override
    public void handle(Event event) {

        //鼠标移动到label位置变颜色，变成小手图案
        label.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                label.setStyle("-fx-text-fill: red");//变成红颜色
                label.setCursor(Cursor.HAND);//变成小手图案
            }
        });
        //鼠标退出时变回原来颜色
        label.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                label.setStyle("-fx-text-fill: #00ccff");
            }
        });
        //给标签添加事件，进入学员基本信息主页面
        label.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                PageStudentMesManage pageStudentMesManage = new PageStudentMesManage();
                Pane pane = RecruitStuLabAction.pageSkipInfo.getPane();
                ObservableList<Node> children = pane.getChildren();
                Integer index = RecruitStuLabAction.pageSkipInfo.getIndex();
                children.set(index,pageStudentMesManage);


            }
        });
    }


}

